package com.deepclassifieds.daas.api.xsd.impl;

import com.deepclassifieds.daas.api.xsd.Shard;

public final class IdentityHelper {
	
	//9223372036854775807;
	//0001000000000000000;
	
	private static final long MAX_LONG = 1000000000000000L;

	private IdentityHelper() {
	}
	
	public static long toLocalId(long globalId) {		
		return globalId % MAX_LONG;
	}

	public static long toGlobalId(Shard shard, long localId) {		
		return (((long)shard.getNumber()) * MAX_LONG) + localId;
	}

}
